/****************************************************************************** 
 * LPC24xx Standard Peripheral Library
 * Version:  1.0.0
 * 
 *  Copyright (C) 2012  Timothy Gack
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA 
 *******************************************************************************
 * Main: Example Application
 *       This example application runs on an Olimex MOD-LCD4.3. 
 *
 *******************************************************************************/

#include <stdint.h>

#include "lpc24xx_pinconnect.h"
#include "lpc24xx_gpio.h"
#include "lpc24xx_system_control.h"

IOPIN_TYPE counter;

int main(void)
{
  /* Use fast I/O */
  SCS.bits.gpiom = GPIOM_FASTIO;

  /* P1.18 - LED - Set pin as GPIO - Output */
  PINSEL3.bits.sb5_4 = PINFN_0;
  FIO1DIR.bits.b18 = DDR_OUT;

  /* Clear the counter */
  counter.value = 0;

  for(;;)
  {
    /* Increment a counter */
    counter.value++;

    /* Flash LED */
    FIO1PIN.bits.b18 = counter.bits.b18;
  }

  return 0;
}